package com.example.travelservlet.collection.service;

import com.example.travelservlet.collection.repository.CollectionRepository;
import com.example.travelservlet.entity.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class CollectionServiceImpl implements CollectionService{
    @Autowired
    private CollectionRepository collectionRepository;
    @Override
    public Collection createCollection(Collection collection) {
        collection.setCollectionId(UUID.randomUUID().toString());
        return collectionRepository.save(collection);
    }

    @Override
    public Collection findCollectionByUserId(String userId) {
//        return collectionRepository.findCollectionByUserId(userId);
        return null;
    }

    @Override
    public List<Collection> findCollectionsByUserId(String userId){
        return collectionRepository.findCollectionsByUserId(userId);
    }
}
